#ifndef UI_SESSION_MESSAGE_H
#define UI_SESSION_MESSAGE_H

#include <mutex>
#include <string>
#include <vector>

#include "common/helpers/context_helper.h"

class UiSessionMessage final
{
public:
    enum Type
    {
        Success,
        Warning,
        Alert,
    };

public:
    UiSessionMessage(
        const crow::json::wvalue& caption,
        const crow::json::wvalue& text,
        Type type
    );

    Common::ContextValue toContextValue() const;

private:
    const crow::json::wvalue m_caption;
    const crow::json::wvalue m_text;
    const Type m_type;
};

class UiSessionMessageList final
{
public:
    void push(const UiSessionMessage& message);
    Common::ContextList toContextList();
    Common::ContextValue toContextValue();

private:
    mutable std::mutex m_lock;
    std::vector<UiSessionMessage> m_data;
};

#endif // UI_SESSION_MESSAGE_H
